#!/bin/sh

# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided this notice is
# preserved.  This file is offered as-is, without any warranty.


IS_SDL2_SHARED=`command -v sdl2-config`
CONFIGURE_OPTIONS=--disable-shared

if test ! $IS_SDL2_SHARED
then
    CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --disable-sdltest"
    CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --with-sdl-prefix=$(pwd)/SDL2/"
    CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS CFLAGS=-I$(pwd)/SDL2/include/"
    CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS SDL_CFLAGS=-I$(pwd)/SDL2/include/"
fi

cd SDL2_gfx/
chmod +x ./configure
./configure $CONFIGURE_OPTIONS
if test $?
then
    make -j`nproc`
fi
